package com.groupbuying.customer.controller;

import com.groupbuying.customer.domain.CustomerUshopDO;
import com.groupbuying.customer.service.CustomerUshopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 够样优店用户表
 *
 * @author zmlmagic
 * @email zmlmagic@163.com
 * @date 2019-05-14 03:22:33
 */

@RestController
@RequestMapping("/customerInfo")
public class CustomerUshopController {

    @Autowired
    private CustomerUshopService customerUshopService;

    /**
     * @api {get} /customerInfo/getMobileByCustomerId 通过customerId获取够样优店用户
     * @apiExample
     * author yangmeng
     * tar TODO 未知调用方
     * date 2019/10/31 14:20
     * @apiGroup bus-customer
     * @apiVersion 1.0.0
     * @apiHeader {String} Authorization 用户授权token
     * @apiParam {String} customerId 会员ID
     * @apiSuccess {String} mobile 用户手机号
     */
    @GetMapping("/getMobileByCustomerId")
    public String getMobileByCustomerId(String customerId) {

        CustomerUshopDO customerUshopDO = customerUshopService.get(customerId);
        if (customerUshopDO == null || customerUshopDO.getMobile() == null) {
            return "未知";
        }

        return customerUshopDO.getMobile();

    }

    /**
     * @api {get} /customerInfo/getMainUuidByCustomerId 通过customerId获取够样优店用户
     * @apiExample
     * author yangmeng
     * tar TODO 未知调用方
     * date 2019/10/31 14:23
     * @apiGroup bus-customer
     * @apiVersion 1.0.0
     * @apiHeader {String} Authorization 用户授权token
     * @apiParam {String} customerId 会员ID
     * @apiSuccess {String} mainUuid 够样主平台uuid
     */
    @GetMapping("/getMainUuidByCustomerId")
    public String getMainUuidByCustomerId(String customerId){
        CustomerUshopDO customerUshopDO = customerUshopService.get(customerId);
        if(customerUshopDO == null || customerUshopDO.getMainUuid() ==null){
            return null;
        }
        return customerUshopDO.getMainUuid();
    }

    //  @Autowired
//  private ModileCodeService modileCodeService;
//
//  	@ApiOperation(value = "校验重置密码验证码", notes = "校验重置密码验证码")
//	@PostMapping("/checkResetCode")
//	public Map checkResetCode(@RequestParam Map<String, Object> params) {
//		params.put("type", ModileCodeTypeConstants.FIND_PWD.getCode());
//		return modileCodeService.checkModileCode(params);
//	}

}
